package com.by.goods.controller;

import com.by.apis.goods.ApGoodsApis;
import com.by.goods.service.ApGoodsService;
import com.by.model.common.dtos.PageResponseResult;
import com.by.model.common.dtos.ResponseResult;
import com.by.model.goods.pojo.ApGoods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("goods")
public class GoodsController implements ApGoodsApis {
    @Autowired
    ApGoodsService apGoodsService;

    @Override
    @PostMapping("add")
    public ResponseResult add(@RequestBody ApGoods apGoods) {
       return apGoodsService.add(apGoods);
    }

    @Override
    @PostMapping("del")
    public ResponseResult del(@RequestBody ApGoods apGoods) {
        return apGoodsService.del(apGoods);
    }

    @Override
    @PostMapping("update")
    public ResponseResult update(@RequestBody ApGoods apGoods) {
        return apGoodsService.update(apGoods);
    }

    @Override
    @RequestMapping("list")
    public PageResponseResult listAll() {
        return apGoodsService.show();
    }

    @Override
    @PostMapping("status")
    public ResponseResult status(@RequestBody ApGoods apGoods) {
        return apGoodsService.status(apGoods);
    }
}
